package com.ruoyi.points.service.impl;

import java.time.LocalDateTime;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.points.mapper.SysUserProfileMapper;
import com.ruoyi.points.domain.SysUserProfile;
import com.ruoyi.points.service.ISysUserProfileService;

/**
 * 用户档案Service业务层处理
 * 
 * @author hh
 * @date 2025-08-18
 */
@Service
public class SysUserProfileServiceImpl implements ISysUserProfileService {

    @Autowired
    private SysUserProfileMapper sysUserProfileMapper;

    /**
     * 查询积分总数
     * 
     * @param id 积分总数主键
     * @return 积分总数
     */
    @Override
    public SysUserProfile selectSysUserProfileById(Long id)
    {
        return sysUserProfileMapper.selectSysUserProfileById(id);
    }

    /**
     * 查询积分总数列表
     * 
     * @param sysUserProfile 积分总数
     * @return 积分总数
     */
    @Override
    public List<SysUserProfile> selectSysUserProfileList(SysUserProfile sysUserProfile)
    {
        return sysUserProfileMapper.selectSysUserProfileList(sysUserProfile);
    }

    /**
     * 新增积分总数
     * 
     * @param sysUserProfile 积分总数
     * @return 结果
     */
    @Override
    public int insertSysUserProfile(SysUserProfile sysUserProfile)
    {
        return sysUserProfileMapper.insertSysUserProfile(sysUserProfile);
    }

    /**
     * 修改积分总数
     * 
     * @param sysUserProfile 积分总数
     * @return 结果
     */
    @Override
    public int updateSysUserProfile(SysUserProfile sysUserProfile)
    {
        return sysUserProfileMapper.updateSysUserProfile(sysUserProfile);
    }

    /**
     * 批量删除积分总数
     * 
     * @param ids 需要删除的积分总数主键
     * @return 结果
     */
    @Override
    public int deleteSysUserProfileByIds(Long[] ids)
    {
        return sysUserProfileMapper.deleteSysUserProfileByIds(ids);
    }

    /**
     * 删除积分总数信息
     * 
     * @param id 积分总数主键
     * @return 结果
     */
    @Override
    public int deleteSysUserProfileById(Long id)
    {
        return sysUserProfileMapper.deleteSysUserProfileById(id);
    }
    
    /**
     * 查询积分总数列表（关联用户信息）
     * 
     * @param sysUserProfile 积分总数
     * @return 积分总数集合
     */
    @Override
    public List<SysUserProfile> selectSysUserProfileListWithUser(SysUserProfile sysUserProfile)
    {
        return sysUserProfileMapper.sysUserProfileAndUser(sysUserProfile);
    }
    
    /**
     * 根据用户ID查询用户档案
     */
    @Override
    public SysUserProfile selectByUserId(Long userId) {
        return sysUserProfileMapper.selectByUserId(userId);
    }

    /**
     * 更新用户积分
     */
    @Override
    public int updatePointsByUserId(Long userId, Integer points) {
        return sysUserProfileMapper.updatePointsByUserId(userId, points);
    }

    /**
     * 修改用户会员类型
     */
    @Override
    public int updateMemberTypeByUserId(Long userId, String memberType, LocalDateTime memberExpire) {
        return sysUserProfileMapper.updateMemberTypeByUserId(userId, memberType, memberExpire);
    }
    /**
     * 根据用户id查询用户档案
     */
    @Override
    public SysUserProfile selectSysUserProfileByUserId(Long userId) {
        return sysUserProfileMapper.selectSysUserProfileByUserId(userId);
    }
}
